"use strict";
function imgSrc(str,src, alt) {
	let index = src.lastIndexOf("/");
	let name = src.substring(0,index);
	if (name.indexOf("Gin") != -1|| name.indexOf("go") != -1){
		name = "Golang"
	}else if (name.indexOf("Eureka") != -1 || name.indexOf("OpenFeign") != -1){
		name = "springcloud"
	}else if (name.indexOf("consul") != -1 || name.indexOf("Gateway") != -1){
		name = "springcloud"
	}else if (name.indexOf("Hystrix") != -1 || name.indexOf("Ribbon") != -1 || name.indexOf("Zookeeper") != -1){
		name = "springcloud"
	}else if (name.indexOf("hymleaf") != -1 || name.indexOf("springboot") != -1){
		name = "Springboot"
	}else if (name.indexOf("net") != -1){
		name = "网络编程"
	}else if (name.indexOf("thread") != -1 || name.indexOf("并发编程") != -1){
		name = "多线程"
	}else if (name.indexOf("IDEA") != -1){
		name = "IDEA"
	}
	src = "https://gitee.com/feigeCode/notes/raw/master/" + name + "/" + src;
	return '<div><img src="' + src + '" alt="' + alt + '" data-src="' + src +'" data-fancybox="gallery"></div>';
}
hexo.extend.tag.register(
	"gallery",
	function (args, content) {
		return `<p><div class="justified-gallery">${hexo.render
			.renderSync({
				text: content,
				engine: "markdown",
			})
			.replace(/<br>/gi, "")
			.replace(/<p>/gi, "")
			.replace(/<p\/?>/gi, "")
			.replace(
				/<img.*?src="(.*?)" alt="(.*?)".*?\/?>/gi,
				'<div><img alt="$2" src="$1" data-src="$1" data-fancybox="gallery"></div>'
			)}
            </div></p>`;
	},
	{ ends: true }
);
